package com.hkbigdata.datagovernance.governance.assess.spec;

import com.hkbigdata.datagovernance.governance.assess.Assessor;
import com.hkbigdata.datagovernance.governance.bean.AssessParam;
import com.hkbigdata.datagovernance.governance.bean.GovernanceAssessDetail;
import com.hkbigdata.datagovernance.governance.bean.GovernanceMetric;
import com.hkbigdata.datagovernance.meta.bean.TableMetaInfo;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;

@Component("TEC_OWNER")
public class TecOwnerAssessor extends Assessor {
    @Override
    public void assess(GovernanceAssessDetail governanceAssessDetail, AssessParam assessParam) {
        TableMetaInfo tableMetaInfo = assessParam.getTableMetaInfo();
        GovernanceMetric governanceMetric = assessParam.getGovernanceMetric();
        if(tableMetaInfo.getTableMetaInfoExtra().getTecOwnerUserName()!=null&&tableMetaInfo.getTableMetaInfoExtra().getTecOwnerUserName().length()>0){
            //技术负责人不为空或者长度大于0，给满分
            governanceAssessDetail.setAssessScore(BigDecimal.valueOf(10));
        }else{
            governanceAssessDetail.setAssessScore(BigDecimal.valueOf(0));
            governanceAssessDetail.setAssessProblem("缺少技术OWNER");
            //设置解决路径
            governanceAssessDetail.setGovernanceUrl(governanceMetric.getGovernanceUrl() +tableMetaInfo.getId());
        }

    }
}
